def chaos():
"""
Generate an inspirational sentence.
Ensure that you are in the proper state of mind before running. ॐ
"""
# Makes a sentence skeleton by randomnly choosing sentence structures
# Reconstructs the sentence by sampling from corresponding POS
# Returns the reconstituted sentence
def ngram_sentence(num_words, model):
# Pads the sentence with start/end tokens
# Predict the next token given the previous n-1 tokens
# All of the observed n-grams in our corpus represent a prob. dist.
# Simulate that probability distribution
# Use probabilities to build a sentence using n-grams
# Returns a cleaner sentence (first word capitalized, periods, etc)
Review:
A bigram makes a prediction for a word based on the one before, and a trigram makes a prediction for the word based on the two words before that.
def duality():
"""
You must only concentrate on the next step, the next breath,
the next stroke of the broom, and the next, and the next.
Nothing else. ॐ
(Bigram Model)
"""
# Returns an inspirational sentence made with a bigram model
def third_eye():
"""
Three things cannot long be hidden: the sun, the moon,
and the truth. ॐ
(Trigram Model)
"""
# Returns an inspirational sentence made with trigrams